package edu.ucsd.cse135.gas.action.chair;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.ucsd.cse135.gas.bean.chair.ReviewerBean;
import edu.ucsd.cse135.gas.logic.Reviewer;
import edu.ucsd.cse135.gas.logic.chair.ReviewProcess;
import edu.ucsd.cse135.gas.resources.Constants;

public class GetReviewersAction extends Action {

	public GetReviewersAction() {
		super();
	}
	
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
		
		
		ArrayList<Reviewer> reviewers = ReviewProcess.getReviewersBlank();
		ArrayList<ReviewerBean> aux = new ArrayList<ReviewerBean>();
		//UsersBean usersBean = new UsersBean();
		
		for(int i = 0; i < reviewers.size(); i++)
		{
			ReviewerBean reviewerBean = new ReviewerBean();
			
			reviewerBean.setMail(reviewers.get(i).getMail());
			
			aux.add(reviewerBean);
		}
		
		//usersBean.setUsers(aux);
		
		request.setAttribute("reviewers", aux);
		
		return mapping.findForward(Constants.SUCCESS);
	}
}
